var express = require('express')
var router = express.Router()


router.use(express.json())

let requestTime = function (req, res, next) {
  req.requestTime = Date.now()
  next()
}

router.use(requestTime)

// define the home page route
router.get('/', function (req, res) {
  console.log(req.requestTime, 'requestTime');
  res.send('home page')
})


// define the home page route
router.post('/', function (req, res) {
  console.log(req.body.name)
  res.send('home page')
})


// define the about route
router.get('/about', function (req, res) {
  res.send('About')
})

module.exports = router
